<template>
  <div>
    <el-table
          :data="content"
          style="width: 100%"
          max-height="700"
          :highlight-current-row="true"
          stripe>
          <el-table-column
            fixed
            width="50">
            </el-table-column>
          <el-table-column
            prop="dstChannelId"
            label="通道标识"
            width="400">
            </el-table-column>
          <el-table-column
            prop="dstChannelName"
            label="通道名称"
            width="350">
            </el-table-column>
          <el-table-column
            prop="operate1"
            label="操作"
            width="500">
            <template slot-scope="scope">
                    <el-button
                      @click.native.prevent="keySynchronise(scope.row)"
                      type="text"
                      size="small">
                      同步
                    </el-button>
                    <el-dialog
                      title="提示"
                      :visible.sync="dialogVisible"
                      :modal-append-to-body='false'
                      width="30%"
                      :before-close="handleClose">
                      <span v-model="message">{{message}}</span>
                      <span slot="footer" class="dialog-footer">
                          <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                        </span>
                    </el-dialog>
                  </template>
          </el-table-column>
        </el-table>
  </div>
</template>
<script>
  export default {
      data() {
        return {
            totalPages: 0,
            page: 0,
            content: [{ dstChannelId: "ESB" ,  dstChannelName : "ESB"}],
            totalElements: 0,
            //后端返回消息，弹框内message
            message : "",
            //弹框是否可见
            dialogVisible: false
        }
      },
      methods:{
        getListInfo:function(){
          // this.$get(``).then((r) => {
          //   console.log(r.data.content);
          //   this.content = r.data.content;
          //   this.totalPages = r.data.totalPages;
          //   this.page = r.data.page;
          //   this.totalElements = r.data.totalElements;
          // })
            this.content = [{ dstChannelId: "ESB" ,  dstChannelName : "ESB"}];
        },
        keySynchronise:function(scopeRow){
          this.$post(`admin/batchtask/keySynchronise`,{
            dstChannelId : scopeRow.dstChannelId,
          }).then((response) =>{
            let responseArr = response.data.message.split("{");
            this.dialogVisible = true;
            console.log(responseArr);
             if (response.data.status === true) {
                    this.message = responseArr[0];
                  } else {
                    this.message = responseArr[0];
                  }

           })
        },
      // mounted: function () {
      //   this.getListInfo();
      // },
    },
    }

</script>
